<?php if(isset($rows)) :?>
<?php foreach($rows as $messege):?>


		<h5>
		    From &nbsp&nbsp
			<?=$messege->sender_name?>
			&nbsp&nbsp To &nbsp&nbsp
			<?=$messege->receiver_name?>
		</h5>
		
		<?php
		$filename=$messege->avatar_name;
		$gallery_path_url=base_url().'images/thumbs/'.$filename;
		$gallery_path = realpath(APPPATH . '../images/thumbs/');
		$avatar_path=$gallery_path.$filename;
		if(!file_exists($avatar_path)):
		?>
		<img src="<?php echo $gallery_path_url; ?>" />
	    <?php endif; ?>
	    <br/>
		<p>
			<?=$messege->content;?>
		</p>
		<?php 
		if(!($messege->senderid==$userid))
		{
			$str = 'messege_controller/to_send_messege?receiverid='.(string)($messege->senderid);
		    echo anchor($str, 'click to reply');
		}
		 ?>


<?php endforeach;?>
<?php else :?>
<h4>There is no new messege now!</h4>
<?php endif; ?>